import { stringify } from 'qs';
import { request } from '../utils/request';

export async function queryContent(params) {
  return request(`/api/content?${stringify(params)}`);
}

export async function queryAuthors(params) {
  return request(`/api/authors?${stringify(params)}`);
}

export async function removeContent(params) {
  return request('/api/content', {
    method: 'POST',
    body: {
      ...params,
      method: 'delete',
    },
  });
}

export async function addContent(params) {
  return request('/api/content', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function queryChannel() {
  return request('/api/channel');
}

export async function queryTags() {
  return request('/api/tags');
}

export async function queryChart() {
  return request('/api/chart');
}

export async function accountLogin(params) {
  return request('/api/login/account', {
    method: 'POST',
    body: params,
  });
}

export async function register(params) {
  return request('/api/register', {
    method: 'POST',
    body: params,
  });
}

export async function queryMembers() {
  return request('/api/members');
}
export async function queryOrders() {
  return request('/api/orders');
}
export async function queryCoupons() {
  return request('/api/coupons');
}
export async function queryMarketing() {
  return request('/api/marketing');
}
export async function queryFrans() {
  return request('/api/frans');
}
export async function queryGoods() {
  return request('/api/goods');
}
export async function queryCategory() {
  return request('/api/category');
}
export async function queryStore() {
  return request('/api/store');
}
